<template>
  <el-card style="margin-bottom: 10px">
    <el-form inline :disabled="scene === 1 ? true : false">
      <el-form-item label="一级分类">
        <el-select v-model="categaryStore.c1Id" @change="handler">
          <el-option
            v-for="item in categaryStore.c1Arr"
            :key="item.id"
            :label="item.name"
            :value="item.id"
          ></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="二级分类">
        <el-select v-model="categaryStore.c2Id" @change="handler1">
          <el-option
            v-for="item in categaryStore.c2Arr"
            :key="item.id"
            :label="item.name"
            :value="item.id"
          ></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="三级分类">
        <el-select v-model="categaryStore.c3Id">
          <el-option
            v-for="item in categaryStore.c3Arr"
            :key="item.id"
            :label="item.name"
            :value="item.id"
          ></el-option>
        </el-select>
      </el-form-item>
    </el-form>
  </el-card>
</template>

<script setup lang="ts">
import {  onMounted } from 'vue'
// const categary1 = ref('')
// const categary2 = ref('')
// const categary3 = ref('')

import useCategaryStore from '@/store/modules/categary'
const categaryStore = useCategaryStore()
onMounted(() => {
  // console.log(categaryStore)
  categaryStore.getC1()
})
const handler = () => {
  categaryStore.c2Id = ''
  categaryStore.c2Arr = []
  categaryStore.c3Id = ''
  categaryStore.c3Arr = []

  categaryStore.getC2()
}
const handler1 = () => {
  categaryStore.c3Id = ''
  categaryStore.c3Arr = []

  categaryStore.getC3()
}
defineProps(['scene'])
</script>

<style scoped></style>
